<?

require_once "PHPUnit/Framework.php";

require_once dirname(__FILE__)."/../../init.php";

Qi_Db::conectar(array("banco" => "mysql"));

abstract class Qi_Test_Db_MySql extends PHPUnit_Framework_TestCase
{
	public function __construct($name = NULL, array $data = array(), $dataName = '')
	{
		parent::__construct($name, $data, $dataName);
		$db_name = strtolower(__CLASS__);
		Qi_Db::query("DROP DATABASE IF EXISTS $db_name");
		Qi_Db::query("CREATE DATABASE IF NOT EXISTS $db_name");
		Qi_Db::selecionar_banco($db_name);
		$this->mainSetup();
	}

	protected function mainSetup()
	{
	}

	protected function mainTearDown()
	{
	}

	public function __destruct()
	{
		$this->mainTearDown();
		$db_name = strtolower(__CLASS__);
		Qi_Db::query("DROP DATABASE IF EXISTS $db_name");
	}
}

?>